'use strict';

const Controller = require('egg').Controller;

class FeedbackController extends Controller {
  // 提交意见反馈
  async createFeedback() {
    const { ctx, service } = this
    const payload = ctx.request.body || {}
    // console.log('payload', payload)
    const res = await service.feedback.createFeedback(payload)
    ctx.body = res
  }

  // 获取全部反馈
  async getFeedback () {
    const { ctx, service } = this
    const params = ctx.query
    const res = await service.feedback.getFeedback(params)
    this.ctx.body = res
  }

  // 获取全部反馈
  async getFeedbackmohu () {
    const { ctx, service } = this
    const params = ctx.query
    const res = await service.feedback.getFeedbackmohu(params)
    this.ctx.body = res
  }

  // 修改信息
  async updateFeedback () {
    const { ctx, service } = this
    const payload = ctx.request.body || {}
    // console.log('payload', payload)
    const res = await service.feedback.updateFeedback(payload)
    this.ctx.body = res
  }

  // 删除
  async deleteFeedback () {
    const { ctx, service } = this
    const payload = ctx.request.body || {}
    // console.log('payload', payload)
    const res = await service.feedback.deleteFeedback(payload)
    this.ctx.body = res
  }
}

module.exports = FeedbackController;
